#!/usr/bin/env node

const loading=require("loading-cli")
const fs=require("fs")
const chalk=require("chalk")

let srr=fs.readFileSync('./animals.txt',"utf-8").split("===============++++SEPERATOR++++====================")

// 随机数
let randomNum=(max,min)=>{
    return Math.floor(Math.random()*(max-min+1))+min
}

// console.log(randomNum(255,0));
// console.log(randomNum(srr.length,0));

let load=loading({
    "text":"正在加载",
    "color":"red",
    "interval":100,
    "stream": process.stdout,
    "frames":["◰", "◳", "◲", "◱"]
}).start()

setTimeout(()=>{
    console.log(chalk.rgb(randomNum(255,0), randomNum(255,0),randomNum(255,0)).bold(srr[randomNum(srr.length,0)]));
    load.text="加载完成"
    load.color="green"
},2000)

setTimeout(()=>{
    load.stop()
},3000)